import type { App } from "vue";
import ElDeleteButton from "./src/button/delete";
import DepartCascader from "./src/cascader/deptCascader";
import ElPageTable from "./src/table/index";
import DepartTree from "./src/tree/deptTree";

/** 单独导出组件 */
export {
    DepartCascader,
    DepartTree,
    ElDeleteButton,
    ElPageTable,
};

/* 使用频率较高的组件, 全局注册, 同时需要在 types/components.d.ts 中声明类型 */
const global = [
    ElDeleteButton,
    ElPageTable,
];

/** 注册通用全局组件 */
export function useReCommon(app: App): void {
    global.forEach((component) => {
        if (component.name) {
            app.component(component.name, component);
        } else {
            console.warn("组件未定义 name 属性, 无法注册全局组件", component);
        }
    });
}
